package gases.as3.librarys.components.ui.control
{
	import gases.as3.librarys.components.skin.data.BaseSkin;
	import gases.as3.librarys.components.skin.data.ButtonSkin;
	import gases.as3.librarys.components.ui.GUIComponents;
	import gases.as3.librarys.components.ui.basic.GLabel;
	/**
	 * CheckBox类
	 * @author gases
	 * 
	 */	
	public class GCheckBox extends GButton
	{
		public static const GAP:Number = 3;//按钮和label之间的间隙
		
		/**
		 *CheckBox 
		 * @param text 设置label
		 * @param labelColor 设置label颜色
		 * 
		 */		
		public function GCheckBox(text:String=null, labelColor:uint=0xFFFFFF,labelSize:int=12)
		{
			if(text != null)
			{
			   _text = text;
			}
			_color = labelColor;
			_size =  labelSize;
			super();
		}
		
		override protected function initialization():void
		{
			super.initialization();
			_label = new GLabel(_text,_color,_size);
			
			this.addChild(_label);
			
		}
		
		override public function set skin(value:BaseSkin):void
		{
			super.skin = value;
			_label.x = background.Gwidth+ GAP;
			_label.y = (background.Gheight - _label.Gheight) * 0.5;
			this.selectState = true;
			this.isSelect = true;
		}
		
		public function set color(value:uint):void
		{
			_color = value;
			_label.color = _color;
		}
		public function set size(value:int):void
		{
			_size = value;
			_label.size = _size;
		}
		
		public function set text(value:String):void
		{
			_label.text = value;
		}
		
		override public function dispose():void
		{
			this.removeChild(_label);
			_label.dispose();
			_label = null;
			super.dispose();
		}
		
		
		private var _text:String = "";
		private var _color:uint;
		private var _size:int;
		
		private var _label:GLabel;
	}
}